package utils.threadpool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * 线程池工具类
 */
public class ThreadPoolUtil {
    /* 下载视频线程池 */
    private final ExecutorService downloadThreadPool = Executors.newFixedThreadPool(10);
    /* Aria2推送下载任务线程池 */
    private final ExecutorService aria2ThreadPool = Executors.newFixedThreadPool(5);
    /* 上传视频线程池 */
    private final ExecutorService webdavThreadPool = Executors.newFixedThreadPool(1);
    /* 定时任务线程池 */
    private final ScheduledExecutorService timerThreadPool = Executors.newScheduledThreadPool(4);

    private ThreadPoolUtil() {
    }

    private static final ThreadPoolUtil instance = new ThreadPoolUtil();

    public static ThreadPoolUtil getInstance() {
        return instance;
    }

    public ExecutorService getDownloadThreadPool() {
        return downloadThreadPool;
    }

    public ScheduledExecutorService getTimerThreadPool() {
        return timerThreadPool;
    }

    public ExecutorService getAria2ThreadPool() {
        return aria2ThreadPool;
    }

    public ExecutorService getWebdavThreadPool() {
        return webdavThreadPool;
    }
}
